using System.IO;
using System.Text;

namespace WowAceUpdater
{
    public partial class rssAddonItem
    {
        internal string GetStringTooltip()
        {
            StringBuilder textb = new StringBuilder();

            using (StringWriter text = new StringWriter(textb))
            {
                if (!string.IsNullOrEmpty(title))
                {
                    text.WriteLine("Title: " + title);
                }
                if (!string.IsNullOrEmpty(description))
                {
                    text.WriteLine("Description: {0}", description);
                }
                if (!string.IsNullOrEmpty(author))
                {
                    text.WriteLine("Author: " + author);
                }
                if (!string.IsNullOrEmpty(pubDate))
                {
                    text.WriteLine("Published date: {0}", pubDate);
                }

                if (category != null && category.Length > 0)
                {
                    string cat = category[category.GetLowerBound(0)];

                    text.WriteLine("Category: " + cat);
                }


                if (!string.IsNullOrEmpty(link))
                {
                    text.WriteLine("Link: " + link);
                }
                if (@interface > 0)
                {
                    text.WriteLine("WoW Interface #: " + @interface);
                }

                if (dependencies != null)
                {
                    text.WriteLine();
                    text.Write("Dependencies: ");
                    bool first = true;
                    foreach (string s in dependencies)
                    {
                        if (first)
                        {
                            text.Write(s);
                            first = false;
                        }
                        else
                            text.Write(", " + s);
                    }

                    text.WriteLine();
                }

                if (provides != null)
                {
                    text.WriteLine();
                    text.Write("Provides: ");
                    bool first = true;
                    foreach (string s in provides)
                    {
                        if (first)
                        {
                            text.Write(s);
                            first = false;
                        }
                        else
                            text.Write(", " + s);
                    }

                    text.WriteLine();
                }


            }
            return textb.ToString();
        }
    }
}